<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>营业执照图片识别</title>
</head>
<body>
<div class="container">
<!--    <h1>营业执照图片识别</h1>-->
    <input type="file" id="imageUpload" accept="image/*">
    <button id="uploadButton">上传并识别eeeeee</button>
    <div id="resultContainer" style="display: none;">
        <h2>识别结果</h2>
        <pre id="result"></pre>
    </div>
</div>
<script src='https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js'></script>
<script>
    getText()
    async function getText() {
        if(!Tesseract) return;
        const worker = await Tesseract.createWorker(['chi_sim'], 1, {
            logger: m => console.log(m),
            errorHandler: err => console.error(err)
        });
        const { data: { text } } = await worker.recognize('./apply_1.png', {
            rectangle: { top: 0, left: 0, width: 1583, height: 1080 },
        }, 'text');
        console.log(text);
        await worker.terminate();
    }
</script>
</body>
</html>
